<template>
  <div class = "container">
    <div class = "input-row">
      <label>游戏名</label>
      <input type="text" v-model="username"/>
    </div>
    <button class = "btn btn-info" @click="login()">登录</button>
  </div>
</template>

<script>
export default {
  name: 'login',
  data: function () {
    return { username: '' }
  },
  methods: {
    login () {
      if (this.username === '') {
        alert('请输入用户名')
        return
      }
      console.log(this.$router)
      this.$store.dispatch('login', this.username)
      this.$router.push({ path: 'ready' })
    }
  }
}
</script>

<style scoped>
.container{
  width: 100%;
  height: calc(100vh);
  text-align: center;
  vertical-align: middle;
}
.input-row{
  width:50%;
  height: 64px;
  line-height: 64px;
  display: inline-block;
  margin:4px 0;
}
.input-row label{
  font-size:2.4rem;
  width:30%;
  display: inline-block;
}
.input-row input{
  width: 68.8%;
  height:64px;
}
</style>
